/*
 * @Description  : Charts 聚合
 * @Autor        : 杜康
 * @Date         : 2023-04-17 10:36:18 +0800
 * @LastEditors  : 杜康
 * @LastEditTime : 2023-04-22 15:12:57 +0800
 */
import { debounce, isEmpty } from "lodash";
import * as echarts from "echarts";
import "echarts";
import VCharts from "vue-echarts";
export default {
  components: { VCharts },
  props: {
    data: {
      type: Object,
      required: true,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 防抖
      debounceInit: debounce(() => {
        this.init();
      }, 1),
      options: {},
      height: 500,
    };
  },
  created() {},
  watch: {
    data: {
      handler(newVal, oldVal) {
        if (!isEmpty(newVal)) {
          this.init();
        }
      },
      deep: true,
    },
  },
  mounted() {
    if (!isEmpty(this.data)) {
      this.init();
    }
  },
  methods: { isEmpty },
};
